home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / biblio / bibtex / mac / macbibtex11.hqx / 0.99c Sources / MacBibTeX 0.99c v1.1.sit / MacBibTex 0.99c V1.1 / bibtex_2.c < prev    next >
C/C++ Source or Header  |  1988-09-02  |  27KB  |  1,127 lines

  1. #include "bibtex.h"
  2.  
  3. #include "bibtex.p"
  4. #include "globals.h"
  5. #include "coerce.h"
  6.  
  7. zbuildin ( pds , len , fnhashloc , bltinnum ) 
  8. pdstype pds ; 
  9. pdslen len ; 
  10. hashloc * fnhashloc ; 
  11. bltinrange bltinnum ; 
  12. {predefine ( pds , len , 11 ) ; 
  13. *  fnhashloc = predefloc ; 
  14.   fntype [ *fnhashloc ] = 0 ; 
  15.   ilkinfo [ *fnhashloc ] = bltinnum ; 
  16.     ;
  17. #ifdef STAT
  18.   bltinloc [ bltinnum ] = *fnhashloc ; 
  19.   executioncount [ bltinnum ] = 0 ; 
  20. #endif /* STAT */
  21. predefcertainstrings () {
  22.     predefine ( ".aux        " , 4 , 7 ) ;
  23.   sauxextension = hashtext [ predefloc ] ; 
  24.   predefine ( ".bbl        " , 4 , 7 ) ; 
  25.   sbblextension = hashtext [ predefloc ] ; 
  26.   predefine ( ".blg        " , 4 , 7 ) ; 
  27.   slogextension = hashtext [ predefloc ] ; 
  28.   predefine ( ".bst        " , 4 , 7 ) ; 
  29.   sbstextension = hashtext [ predefloc ] ; 
  30.   predefine ( ".bib        " , 4 , 7 ) ; 
  31.   sbibextension = hashtext [ predefloc ] ; 
  32.   predefine ( "texinputs:  " , 10 , 8 ) ; 
  33.   sbstarea = hashtext [ predefloc ] ; 
  34.   predefine ( "texbib:     " , 7 , 8 ) ; 
  35.   sbibarea = hashtext [ predefloc ] ; 
  36.   predefine ( "\\citation   " , 9 , 2 ) ; 
  37.   ilkinfo [ predefloc ] = 2 ; 
  38.   predefine ( "\\bibdata    " , 8 , 2 ) ; 
  39.   ilkinfo [ predefloc ] = 0 ; 
  40.   predefine ( "\\bibstyle   " , 9 , 2 ) ; 
  41.   ilkinfo [ predefloc ] = 1 ; 
  42.   predefine ( "\\@input     " , 7 , 2 ) ; 
  43.   ilkinfo [ predefloc ] = 3 ; 
  44.   predefine ( "entry       " , 5 , 4 ) ; 
  45.   ilkinfo [ predefloc ] = 0 ; 
  46.   predefine ( "execute     " , 7 , 4 ) ; 
  47.   ilkinfo [ predefloc ] = 1 ; 
  48.   predefine ( "function    " , 8 , 4 ) ; 
  49.   ilkinfo [ predefloc ] = 2 ; 
  50.   predefine ( "integers    " , 8 , 4 ) ; 
  51.   ilkinfo [ predefloc ] = 3 ; 
  52.   predefine ( "iterate     " , 7 , 4 ) ; 
  53.   ilkinfo [ predefloc ] = 4 ; 
  54.   predefine ( "macro       " , 5 , 4 ) ; 
  55.   ilkinfo [ predefloc ] = 5 ; 
  56.   predefine ( "read        " , 4 , 4 ) ; 
  57.   ilkinfo [ predefloc ] = 6 ; 
  58.   predefine ( "reverse     " , 7 , 4 ) ; 
  59.   ilkinfo [ predefloc ] = 7 ; 
  60.   predefine ( "sort        " , 4 , 4 ) ; 
  61.   ilkinfo [ predefloc ] = 8 ; 
  62.   predefine ( "strings     " , 7 , 4 ) ; 
  63.   ilkinfo [ predefloc ] = 9 ; 
  64.   predefine ( "comment     " , 7 , 12 ) ; 
  65.   ilkinfo [ predefloc ] = 0 ; 
  66.   predefine ( "preamble    " , 8 , 12 ) ; 
  67.   ilkinfo [ predefloc ] = 1 ; 
  68.   predefine ( "string      " , 6 , 12 ) ; 
  69.   ilkinfo [ predefloc ] = 2 ; 
  70.   buildin ( "=           " , 1 , bequals , 0 ) ; 
  71.   buildin ( ">           " , 1 , bgreaterthan , 1 ) ; 
  72.   buildin ( "<           " , 1 , blessthan , 2 ) ; 
  73.   buildin ( "+           " , 1 , bplus , 3 ) ; 
  74.   buildin ( "-           " , 1 , bminus , 4 ) ; 
  75.   buildin ( "*           " , 1 , bconcatenate , 5 ) ; 
  76.   buildin ( ":=          " , 2 , bgets , 6 ) ; 
  77.   buildin ( "add.period$ " , 11 , baddperiod , 7 ) ; 
  78.   buildin ( "call.type$  " , 10 , bcalltype , 8 ) ; 
  79.   buildin ( "change.case$" , 12 , bchangecase , 9 ) ; 
  80.   buildin ( "chr.to.int$ " , 11 , bchrtoint , 10 ) ; 
  81.   buildin ( "cite$       " , 5 , bcite , 11 ) ; 
  82.   buildin ( "duplicate$  " , 10 , bduplicate , 12 ) ; 
  83.   buildin ( "empty$      " , 6 , bempty , 13 ) ; 
  84.   buildin ( "format.name$" , 12 , bformatname , 14 ) ; 
  85.   buildin ( "if$         " , 3 , bif , 15 ) ; 
  86.   buildin ( "int.to.chr$ " , 11 , binttochr , 16 ) ; 
  87.   buildin ( "int.to.str$ " , 11 , binttostr , 17 ) ; 
  88.   buildin ( "missing$    " , 8 , bmissing , 18 ) ; 
  89.   buildin ( "newline$    " , 8 , bnewline , 19 ) ; 
  90.   buildin ( "num.names$  " , 10 , bnumnames , 20 ) ; 
  91.   buildin ( "pop$        " , 4 , bpop , 21 ) ; 
  92.   buildin ( "preamble$   " , 9 , bpreamble , 22 ) ; 
  93.   buildin ( "purify$     " , 7 , bpurify , 23 ) ; 
  94.   buildin ( "quote$      " , 6 , bquote , 24 ) ; 
  95.   buildin ( "skip$       " , 5 , bskip , 25 ) ; 
  96.   buildin ( "stack$      " , 6 , bstack , 26 ) ; 
  97.   buildin ( "substring$  " , 10 , bsubstring , 27 ) ; 
  98.   buildin ( "swap$       " , 5 , bswap , 28 ) ; 
  99.   buildin ( "text.length$" , 12 , btextlength , 29 ) ; 
  100.   buildin ( "text.prefix$" , 12 , btextprefix , 30 ) ; 
  101.   buildin ( "top$        " , 4 , btopstack , 31 ) ; 
  102.   buildin ( "type$       " , 5 , btype , 32 ) ; 
  103.   buildin ( "warning$    " , 8 , bwarning , 33 ) ; 
  104.   buildin ( "width$      " , 6 , bwidth , 35 ) ; 
  105.   buildin ( "while$      " , 6 , bwhile , 34 ) ; 
  106.   buildin ( "width$      " , 6 , bwidth , 35 ) ; 
  107.   buildin ( "write$      " , 6 , bwrite , 36 ) ; 
  108.   predefine ( "            " , 0 , 0 ) ; 
  109.   snull = hashtext [ predefloc ] ; 
  110.   fntype [ predefloc ] = 3 ; 
  111.   predefine ( "default.type" , 12 , 0 ) ; 
  112.   sdefault = hashtext [ predefloc ] ; 
  113.   fntype [ predefloc ] = 3 ; 
  114.   bdefault = bskip ; 
  115.   preambleptr = 0 ; 
  116.   predefine ( "i           " , 1 , 14 ) ; 
  117.   ilkinfo [ predefloc ] = 0 ; 
  118.   predefine ( "j           " , 1 , 14 ) ; 
  119.   ilkinfo [ predefloc ] = 1 ; 
  120.   predefine ( "oe          " , 2 , 14 ) ; 
  121.   ilkinfo [ predefloc ] = 2 ; 
  122.   predefine ( "OE          " , 2 , 14 ) ; 
  123.   ilkinfo [ predefloc ] = 3 ; 
  124.   predefine ( "ae          " , 2 , 14 ) ; 
  125.   ilkinfo [ predefloc ] = 4 ; 
  126.   predefine ( "AE          " , 2 , 14 ) ; 
  127.   ilkinfo [ predefloc ] = 5 ; 
  128.   predefine ( "aa          " , 2 , 14 ) ; 
  129.   ilkinfo [ predefloc ] = 6 ; 
  130.   predefine ( "AA          " , 2 , 14 ) ; 
  131.   ilkinfo [ predefloc ] = 7 ; 
  132.   predefine ( "o           " , 1 , 14 ) ; 
  133.   ilkinfo [ predefloc ] = 8 ; 
  134.   predefine ( "O           " , 1 , 14 ) ; 
  135.   ilkinfo [ predefloc ] = 9 ; 
  136.   predefine ( "l           " , 1 , 14 ) ; 
  137.   ilkinfo [ predefloc ] = 10 ; 
  138.   predefine ( "L           " , 1 , 14 ) ; 
  139.   ilkinfo [ predefloc ] = 11 ; 
  140.   predefine ( "ss          " , 2 , 14 ) ; 
  141.   ilkinfo [ predefloc ] = 12 ; 
  142.   predefine ( "crossref    " , 8 , 11 ) ; 
  143.   fntype [ predefloc ] = 4 ; 
  144.   ilkinfo [ predefloc ] = numfields ; 
  145.   crossrefnum = numfields ; 
  146.   incr ( numfields ) ; 
  147.   numpredefinedfields = numfields ; 
  148.   predefine ( "sort.key$   " , 9 , 11 ) ; 
  149.   fntype [ predefloc ] = 6 ; 
  150.   ilkinfo [ predefloc ] = numentstrs ; 
  151.   sortkeynum = numentstrs ; 
  152.   incr ( numentstrs ) ; 
  153.   predefine ( "entry.max$  " , 10 , 11 ) ; 
  154.   fntype [ predefloc ] = 7 ; 
  155.   ilkinfo [ predefloc ] = entstrsize ; 
  156.   predefine ( "global.max$ " , 11 , 11 ) ; 
  157.   fntype [ predefloc ] = 7 ; 
  158.   ilkinfo [ predefloc ] = globstrsize ; 
  159. boolean zscan1 ( char1 ) 
  160. ASCIIcode char1 ; 
  161. {register boolean Result; bufptr1 = bufptr2 ; 
  162.   while ( ( ( buffer [ bufptr2 ] != char1 ) && ( bufptr2 < last ) ) ) incr ( 
  163.   bufptr2 ) ; 
  164.   if ( ( bufptr2 < last ) ) 
  165.   Result = true ; 
  166.   else Result = false ; 
  167.   return(Result) ; 
  168. boolean zscan1white ( char1 ) 
  169. ASCIIcode char1 ; 
  170. {register boolean Result; bufptr1 = bufptr2 ; 
  171.   while ( ( ( lexclass [ buffer [ bufptr2 ] ] != 1 ) && ( buffer [ bufptr2 ] 
  172.   != char1 ) && ( bufptr2 < last ) ) ) incr ( bufptr2 ) ; 
  173.   if ( ( bufptr2 < last ) ) 
  174.   Result = true ; 
  175.   else Result = false ; 
  176.   return(Result) ; 
  177. boolean zscan2 ( char1 , char2 ) 
  178. ASCIIcode char1 , char2 ; 
  179. {register boolean Result; bufptr1 = bufptr2 ; 
  180.   while ( ( ( buffer [ bufptr2 ] != char1 ) && ( buffer [ bufptr2 ] != char2 ) 
  181.   && ( bufptr2 < last ) ) ) incr ( bufptr2 ) ; 
  182.   if ( ( bufptr2 < last ) ) 
  183.   Result = true ; 
  184.   else Result = false ; 
  185.   return(Result) ; 
  186. boolean zscan2white ( char1 , char2 ) 
  187. ASCIIcode char1 , char2 ; 
  188. {register boolean Result; bufptr1 = bufptr2 ; 
  189.   while ( ( ( buffer [ bufptr2 ] != char1 ) && ( buffer [ bufptr2 ] != char2 ) 
  190.   && ( lexclass [ buffer [ bufptr2 ] ] != 1 ) && ( bufptr2 < last ) ) ) incr ( 
  191.   bufptr2 ) ; 
  192.   if ( ( bufptr2 < last ) ) 
  193.   Result = true ; 
  194.   else Result = false ; 
  195.   return(Result) ; 
  196. boolean zscan3 ( char1 , char2 , char3 ) 
  197. ASCIIcode char1 , char2 , char3 ; 
  198. {register boolean Result; bufptr1 = bufptr2 ; 
  199.   while ( ( ( buffer [ bufptr2 ] != char1 ) && ( buffer [ bufptr2 ] != char2 ) 
  200.   && ( buffer [ bufptr2 ] != char3 ) && ( bufptr2 < last ) ) ) incr ( bufptr2 
  201.   ) ; 
  202.   if ( ( bufptr2 < last ) ) 
  203.   Result = true ; 
  204.   else Result = false ; 
  205.   return(Result) ; 
  206. boolean scanalpha () {
  207.     register boolean Result; bufptr1 = bufptr2 ; 
  208.   while ( ( ( lexclass [ buffer [ bufptr2 ] ] == 2 ) && ( bufptr2 < last ) ) ) 
  209.   incr ( bufptr2 ) ; 
  210.   if ( ( ( bufptr2 - bufptr1 ) == 0 ) ) 
  211.   Result = false ; 
  212.   else Result = true ; 
  213.   return(Result) ; 
  214. zscanidentifier ( char1 , char2 , char3 ) 
  215. ASCIIcode char1 , char2 , char3 ; 
  216. {bufptr1 = bufptr2 ; 
  217.   if ( ( lexclass [ buffer [ bufptr2 ] ] != 3 ) ) 
  218.   while ( ( ( idclass [ buffer [ bufptr2 ] ] == 1 ) && ( bufptr2 < last ) ) ) 
  219.   incr ( bufptr2 ) ; 
  220.   if ( ( ( bufptr2 - bufptr1 ) == 0 ) ) 
  221.   scanresult = 0 ; 
  222.   else if ( ( ( lexclass [ buffer [ bufptr2 ] ] == 1 ) || ( bufptr2 == last ) 
  223.   ) ) 
  224.   scanresult = 3 ; 
  225.   else if ( ( ( buffer [ bufptr2 ] == char1 ) || ( buffer [ bufptr2 ] == char2 
  226.   ) || ( buffer [ bufptr2 ] == char3 ) ) ) 
  227.   scanresult = 1 ; 
  228.   else scanresult = 2 ; 
  229. boolean scannonneginteger () {
  230.     register boolean Result; bufptr1 = bufptr2 ; 
  231.   tokenvalue = 0 ; 
  232.   while ( ( ( lexclass [ buffer [ bufptr2 ] ] == 3 ) && ( bufptr2 < last ) ) ) 
  233.   {
  234.     tokenvalue = tokenvalue * 10 + ( buffer [ bufptr2 ] - 48 ) ; 
  235.     incr ( bufptr2 ) ; 
  236.   } 
  237.   if ( ( ( bufptr2 - bufptr1 ) == 0 ) ) 
  238.   Result = false ; 
  239.   else Result = true ; 
  240.   return(Result) ; 
  241. boolean scaninteger () {
  242.     register boolean Result; schar signlength  ; 
  243.   bufptr1 = bufptr2 ; 
  244.   if ( ( buffer [ bufptr2 ] == 45 ) ) 
  245.   {
  246.     signlength = 1 ; 
  247.     incr ( bufptr2 ) ; 
  248.   } 
  249.   else signlength = 0 ; 
  250.   tokenvalue = 0 ; 
  251.   while ( ( ( lexclass [ buffer [ bufptr2 ] ] == 3 ) && ( bufptr2 < last ) ) ) 
  252.   {
  253.     tokenvalue = tokenvalue * 10 + ( buffer [ bufptr2 ] - 48 ) ; 
  254.     incr ( bufptr2 ) ; 
  255.   } 
  256.   if ( ( ( signlength == 1 ) ) ) 
  257.   tokenvalue = - (integer) tokenvalue ; 
  258.   if ( ( ( bufptr2 - bufptr1 ) == signlength ) ) 
  259.   Result = false ; 
  260.   else Result = true ; 
  261.   return(Result) ; 
  262. boolean scanwhitespace () {
  263.     register boolean Result; while ( ( ( lexclass [ 
  264.   buffer [ bufptr2 ] ] == 1 ) && ( bufptr2 < last ) ) ) incr ( bufptr2 ) ; 
  265.   if ( ( bufptr2 < last ) ) 
  266.   Result = true ; 
  267.   else Result = false ; 
  268.   return(Result) ; 
  269. boolean eatbstwhitespace () {
  270.     /* 10 */ register boolean Result; while ( true ) 
  271.   {
  272.     if ( ( scanwhitespace () ) ) 
  273.     if ( ( buffer [ bufptr2 ] != 37 ) ) 
  274.     {
  275.       Result = true ; 
  276.       goto lab10 ; 
  277.     } 
  278.     if ( ( ! inputln ( bstfile ) ) ) 
  279.     {
  280.       Result = false ; 
  281.       goto lab10 ; 
  282.     } 
  283.     incr ( bstlinenum ) ; 
  284.     bufptr2 = 0 ; 
  285.   } 
  286.   lab10: ; 
  287.   return(Result) ; 
  288. skiptokenprint () {
  289.     { 
  290.     (void) putc( '-' ,  logfile );
  291.     (void) putc( '-' ,  stdout );
  292.   } 
  293.   bstlnnumprint () ; 
  294.   markerror () ; 
  295.   if ( ( scan2white ( 125 , 37 ) ) ) 
  296.   ; 
  297. printrecursionillega () {
  298.     
  299.     ;
  300. #ifdef TRACE
  301.   {
  302.     (void) putc('\n',  logfile );
  303.   } 
  304. #endif /* TRACE */
  305.   {
  306.     (void) fprintf( logfile , "%s\n",  "Curse you, wizard, before you recurse me:" ) ; 
  307.     (void) fprintf( stdout , "%s\n",  "Curse you, wizard, before you recurse me:" ) ; 
  308.   } 
  309.   {
  310.     (void) Fputs( logfile ,  "function " ) ; 
  311.     (void) Fputs( stdout ,  "function " ) ; 
  312.   } 
  313.   printatoken () ; 
  314.   {
  315.     (void) fprintf( logfile , "%s\n",  " is illegal in its own definition" ) ; 
  316.     (void) fprintf( stdout , "%s\n",  " is illegal in its own definition" ) ; 
  317.   } 
  318.   skiptokenprint () ; 
  319. skptokenunknownfunct () {
  320.     printatoken () ; 
  321.   {
  322.     (void) Fputs( logfile ,  " is an unknown function" ) ; 
  323.     (void) Fputs( stdout ,  " is an unknown function" ) ; 
  324.   } 
  325.   skiptokenprint () ; 
  326. skipillegalstuffafte () {
  327.     { 
  328.     (void) fprintf( logfile , "%c%c%s",  '"' , xchr [ buffer [ bufptr2 ] ] ,     "\" can't follow a literal" ) ; 
  329.     (void) fprintf( stdout , "%c%c%s",  '"' , xchr [ buffer [ bufptr2 ] ] ,     "\" can't follow a literal" ) ; 
  330.   } 
  331.   skiptokenprint () ; 
  332. zscanfndef ( fnhashloc ) 
  333. hashloc fnhashloc ; 
  334. {/* 25 10 */ typedef integer fndefloc  ; 
  335.   hashptr2 singlfunction[singlefnspace + 1]  ; 
  336.   fndefloc singleptr  ; 
  337.   fndefloc copyptr  ; 
  338.   bufpointer endofnum  ; 
  339.   hashloc implfnloc  ; 
  340.   {
  341.     if ( ( ! eatbstwhitespace () ) ) 
  342.     {
  343.       eatbstprint () ; 
  344.       {
  345.     {
  346.       (void) Fputs( logfile ,  "function" ) ; 
  347.       (void) Fputs( stdout ,  "function" ) ; 
  348.     } 
  349.     {
  350.       bsterrprintandlookfo () ; 
  351.       goto lab10 ; 
  352.     } 
  353.       } 
  354.     } 
  355.   } 
  356.   singleptr = 0 ; 
  357.   while ( ( buffer [ bufptr2 ] != 125 ) ) {
  358.       
  359.     switch ( ( buffer [ bufptr2 ] ) ) 
  360.     {case 35 : 
  361.       {
  362.     incr ( bufptr2 ) ; 
  363.     if ( ( ! scaninteger () ) ) 
  364.     {
  365.       {
  366.         (void) Fputs( logfile ,  "Illegal integer in integer literal" ) ; 
  367.         (void) Fputs( stdout ,  "Illegal integer in integer literal" ) ; 
  368.       } 
  369.       skiptokenprint () ; 
  370.       goto lab25 ; 
  371.     } 
  372.     ;
  373. #ifdef TRACE
  374.     {
  375.       (void) putc( '#' ,  logfile );
  376.     } 
  377.     {
  378.       outtoken ( logfile ) ; 
  379.     } 
  380.     {
  381.       (void) fprintf( logfile , "%s%ld\n",  " is an integer literal with value " ,           (long)tokenvalue ) ; 
  382.     } 
  383. #endif /* TRACE */
  384.     literalloc = strlookup ( buffer , bufptr1 , ( bufptr2 - bufptr1 ) , 1 
  385.     , true ) ; 
  386.     if ( ( ! hashfound ) ) 
  387.     {
  388.       fntype [ literalloc ] = 2 ; 
  389.       ilkinfo [ literalloc ] = tokenvalue ; 
  390.     } 
  391.     if ( ( ( lexclass [ buffer [ bufptr2 ] ] != 1 ) && ( bufptr2 < last ) 
  392.     && ( buffer [ bufptr2 ] != 125 ) && ( buffer [ bufptr2 ] != 37 ) ) ) 
  393.     {
  394.       skipillegalstuffafte () ; 
  395.       goto lab25 ; 
  396.     } 
  397.     {
  398.       singlfunction [ singleptr ] = literalloc ; 
  399.       if ( ( singleptr == singlefnspace ) ) 
  400.       singlfnoverflow () ; 
  401.       incr ( singleptr ) ; 
  402.     } 
  403.       } 
  404.       break ; 
  405.     case 34 : 
  406.       {
  407.     incr ( bufptr2 ) ; 
  408.     if ( ( ! scan1 ( 34 ) ) ) 
  409.     {
  410.       {
  411.         (void) fprintf( logfile , "%s%c%s",  "No `" , xchr [ 34 ] , "' to end string literal"             ) ; 
  412.         (void) fprintf( stdout , "%s%c%s",  "No `" , xchr [ 34 ] , "' to end string literal"             ) ; 
  413.       } 
  414.       skiptokenprint () ; 
  415.       goto lab25 ; 
  416.     } 
  417.     ;
  418. #ifdef TRACE
  419.     {
  420.       (void) putc( '"' ,  logfile );
  421.     } 
  422.     {
  423.       outtoken ( logfile ) ; 
  424.     } 
  425.     {
  426.       (void) putc( '"' ,  logfile );
  427.     } 
  428.     {
  429.       (void) fprintf( logfile , "%s\n",  " is a string literal" ) ; 
  430.     } 
  431. #endif /* TRACE */
  432.     literalloc = strlookup ( buffer , bufptr1 , ( bufptr2 - bufptr1 ) , 0 
  433.     , true ) ; 
  434.     fntype [ literalloc ] = 3 ; 
  435.     incr ( bufptr2 ) ; 
  436.     if ( ( ( lexclass [ buffer [ bufptr2 ] ] != 1 ) && ( bufptr2 < last ) 
  437.     && ( buffer [ bufptr2 ] != 125 ) && ( buffer [ bufptr2 ] != 37 ) ) ) 
  438.     {
  439.       skipillegalstuffafte () ; 
  440.       goto lab25 ; 
  441.     } 
  442.     {
  443.       singlfunction [ singleptr ] = literalloc ; 
  444.       if ( ( singleptr == singlefnspace ) ) 
  445.       singlfnoverflow () ; 
  446.       incr ( singleptr ) ; 
  447.     } 
  448.       } 
  449.       break ; 
  450.     case 39 : 
  451.       {
  452.     incr ( bufptr2 ) ; 
  453.     if ( ( scan2white ( 125 , 37 ) ) ) 
  454.     ; 
  455.     ;
  456. #ifdef TRACE
  457.     {
  458.       (void) putc( '\'' ,  logfile );
  459.     } 
  460.     {
  461.       outtoken ( logfile ) ; 
  462.     } 
  463.     {
  464.       (void) Fputs( logfile ,  " is a quoted function " ) ; 
  465.     } 
  466. #endif /* TRACE */
  467.     lowercase ( buffer , bufptr1 , ( bufptr2 - bufptr1 ) ) ; 
  468.     fnloc = strlookup ( buffer , bufptr1 , ( bufptr2 - bufptr1 ) , 11 , 
  469.     false ) ; 
  470.     if ( ( ! hashfound ) ) 
  471.     {
  472.       skptokenunknownfunct () ; 
  473.       goto lab25 ; 
  474.     } 
  475.     else {
  476.         
  477.       if ( ( fnloc == wizloc ) ) 
  478.       {
  479.         printrecursionillega () ; 
  480.         goto lab25 ; 
  481.       } 
  482.       else {
  483.           
  484.     ;
  485. #ifdef TRACE
  486.         {
  487.           (void) Fputs( logfile ,  "of type " ) ; 
  488.         } 
  489.         traceprfnclass ( fnloc ) ; 
  490.         {
  491.           (void) putc('\n',  logfile );
  492.         } 
  493. #endif /* TRACE */
  494.         {
  495.           singlfunction [ singleptr ] = 0 ; 
  496.           if ( ( singleptr == singlefnspace ) ) 
  497.           singlfnoverflow () ; 
  498.           incr ( singleptr ) ; 
  499.         } 
  500.         {
  501.           singlfunction [ singleptr ] = fnloc ; 
  502.           if ( ( singleptr == singlefnspace ) ) 
  503.           singlfnoverflow () ; 
  504.           incr ( singleptr ) ; 
  505.         } 
  506.       } 
  507.     } 
  508.       } 
  509.       break ; 
  510.     case 123 : 
  511.       {
  512.     exbuf [ 0 ] = 39 ; 
  513.     inttoASCII ( implfnnum , exbuf , 1 , endofnum ) ; 
  514.     implfnloc = strlookup ( exbuf , 0 , endofnum , 11 , true ) ; 
  515.     if ( ( hashfound ) ) 
  516.     {
  517.       {
  518.         (void) Fputs( logfile ,  "Already encountered implicit function" ) ; 
  519.         (void) Fputs( stdout ,  "Already encountered implicit function" ) ; 
  520.       } 
  521.       printconfusion () ; 
  522.       longjmp(jmp9998,1) ; 
  523.     } 
  524.     ;
  525. #ifdef TRACE
  526.     {
  527.       outpoolstr ( logfile , hashtext [ implfnloc ] ) ; 
  528.     } 
  529.     {
  530.       (void) fprintf( logfile , "%s\n",  " is an implicit function" ) ; 
  531.     } 
  532. #endif /* TRACE */
  533.     incr ( implfnnum ) ; 
  534.     fntype [ implfnloc ] = 1 ; 
  535.     {
  536.       singlfunction [ singleptr ] = 0 ; 
  537.       if ( ( singleptr == singlefnspace ) ) 
  538.       singlfnoverflow () ; 
  539.       incr ( singleptr ) ; 
  540.     } 
  541.     {
  542.       singlfunction [ singleptr ] = implfnloc ; 
  543.       if ( ( singleptr == singlefnspace ) ) 
  544.       singlfnoverflow () ; 
  545.       incr ( singleptr ) ; 
  546.     } 
  547.     incr ( bufptr2 ) ; 
  548.     scanfndef ( implfnloc ) ; 
  549.       } 
  550.       break ; 
  551.       default: 
  552.       {
  553.     if ( ( scan2white ( 125 , 37 ) ) ) 
  554.     ; 
  555.     ;
  556. #ifdef TRACE
  557.     {
  558.       outtoken ( logfile ) ; 
  559.     } 
  560.     {
  561.       (void) Fputs( logfile ,  " is a function " ) ; 
  562.     } 
  563. #endif /* TRACE */
  564.     lowercase ( buffer , bufptr1 , ( bufptr2 - bufptr1 ) ) ; 
  565.     fnloc = strlookup ( buffer , bufptr1 , ( bufptr2 - bufptr1 ) , 11 , 
  566.     false ) ; 
  567.     if ( ( ! hashfound ) ) 
  568.     {
  569.       skptokenunknownfunct () ; 
  570.       goto lab25 ; 
  571.     } 
  572.     else if ( ( fnloc == wizloc ) ) 
  573.     {
  574.       printrecursionillega () ; 
  575.       goto lab25 ; 
  576.     } 
  577.     else {
  578.         
  579.     ;
  580. #ifdef TRACE
  581.       {
  582.         (void) Fputs( logfile ,  "of type " ) ; 
  583.       } 
  584.       traceprfnclass ( fnloc ) ; 
  585.       {
  586.         (void) putc('\n',  logfile );
  587.       } 
  588. #endif /* TRACE */
  589.       {
  590.         singlfunction [ singleptr ] = fnloc ; 
  591.         if ( ( singleptr == singlefnspace ) ) 
  592.         singlfnoverflow () ; 
  593.         incr ( singleptr ) ; 
  594.       } 
  595.     } 
  596.       } 
  597.       break ; 
  598.     } 
  599.     lab25: {
  600.     
  601.       if ( ( ! eatbstwhitespace () ) ) 
  602.       {
  603.     eatbstprint () ; 
  604.     {
  605.       {
  606.         (void) Fputs( logfile ,  "function" ) ; 
  607.         (void) Fputs( stdout ,  "function" ) ; 
  608.       } 
  609.       {
  610.         bsterrprintandlookfo () ; 
  611.         goto lab10 ; 
  612.       } 
  613.     } 
  614.       } 
  615.     } 
  616.   } 
  617.   {
  618.     {
  619.       singlfunction [ singleptr ] = 5001 ; 
  620.       if ( ( singleptr == singlefnspace ) ) 
  621.       singlfnoverflow () ; 
  622.       incr ( singleptr ) ; 
  623.     } 
  624.     if ( ( singleptr + wizdefptr > wizfnspace ) ) 
  625.     {
  626.       {
  627.     (void) fprintf( logfile , "%ld%s",  (long)singleptr + wizdefptr , ": " ) ; 
  628.     (void) fprintf( stdout , "%ld%s",  (long)singleptr + wizdefptr , ": " ) ; 
  629.       } 
  630.       {
  631.     printoverflow () ; 
  632.     {
  633.       (void) fprintf( logfile , "%s%ld\n",  "wizard-defined function space " , (long)wizfnspace ) 
  634.       ; 
  635.       (void) fprintf( stdout , "%s%ld\n",  "wizard-defined function space " , (long)wizfnspace ) ; 
  636.     } 
  637.     longjmp(jmp9998,1) ; 
  638.       } 
  639.     } 
  640.     ilkinfo [ fnhashloc ] = wizdefptr ; 
  641.     copyptr = 0 ; 
  642.     while ( ( copyptr < singleptr ) ) {
  643.     
  644.       wizfunctions [ wizdefptr ] = singlfunction [ copyptr ] ; 
  645.       incr ( copyptr ) ; 
  646.       incr ( wizdefptr ) ; 
  647.     } 
  648.   } 
  649.   incr ( bufptr2 ) ; 
  650.   lab10: ; 
  651. boolean eatbibwhitespace () {
  652.     /* 10 */ register boolean Result; while ( ( ! 
  653.   scanwhitespace () ) ) {
  654.       
  655.     if ( ( ! inputln ( bibfile [ bibptr ] ) ) ) 
  656.     {
  657.       Result = false ; 
  658.       goto lab10 ; 
  659.     } 
  660.     incr ( biblinenum ) ; 
  661.     bufptr2 = 0 ; 
  662.   } 
  663.   Result = true ; 
  664.   lab10: ; 
  665.   return(Result) ; 
  666. boolean compressbibwhite () {
  667.     /* 10 */ register boolean Result; Result = false 
  668.   ; 
  669.   {
  670.     if ( ( exbufptr == bufsize ) ) 
  671.     {
  672.       bibfieldtoolongprint () ; 
  673.       goto lab10 ; 
  674.     } 
  675.     else {
  676.     
  677.       exbuf [ exbufptr ] = 32 ; 
  678.       incr ( exbufptr ) ; 
  679.     } 
  680.   } 
  681.   while ( ( ! scanwhitespace () ) ) {
  682.       
  683.     if ( ( ! inputln ( bibfile [ bibptr ] ) ) ) 
  684.     {
  685.       eatbibprint () ; 
  686.       goto lab10 ; 
  687.     } 
  688.     incr ( biblinenum ) ; 
  689.     bufptr2 = 0 ; 
  690.   } 
  691.   Result = true ; 
  692.   lab10: ; 
  693.   return(Result) ; 
  694. boolean scanbalancedbraces () {
  695.     /* 15 10 */ register boolean Result; Result = 
  696.   false ; 
  697.   incr ( bufptr2 ) ; 
  698.   {
  699.     if ( ( ( lexclass [ buffer [ bufptr2 ] ] == 1 ) || ( bufptr2 == last ) ) ) 
  700.     if ( ( ! compressbibwhite () ) ) 
  701.     goto lab10 ; 
  702.   } 
  703.   if ( ( exbufptr > 1 ) ) 
  704.   if ( ( exbuf [ exbufptr - 1 ] == 32 ) ) 
  705.   if ( ( exbuf [ exbufptr - 2 ] == 32 ) ) 
  706.   decr ( exbufptr ) ; 
  707.   bibbracelevel = 0 ; 
  708.   if ( ( storefield ) ) 
  709.   {
  710.     while ( ( buffer [ bufptr2 ] != rightstrdelim ) ) switch ( ( buffer [ 
  711.     bufptr2 ] ) ) 
  712.     {case 123 : 
  713.       {
  714.     incr ( bibbracelevel ) ; 
  715.     {
  716.       if ( ( exbufptr == bufsize ) ) 
  717.       {
  718.         bibfieldtoolongprint () ; 
  719.         goto lab10 ; 
  720.       } 
  721.       else {
  722.           
  723.         exbuf [ exbufptr ] = 123 ; 
  724.         incr ( exbufptr ) ; 
  725.       } 
  726.     } 
  727.     incr ( bufptr2 ) ; 
  728.     {
  729.       if ( ( ( lexclass [ buffer [ bufptr2 ] ] == 1 ) || ( bufptr2 == last 
  730.       ) ) ) 
  731.       if ( ( ! compressbibwhite () ) ) 
  732.       goto lab10 ; 
  733.     } 
  734.     {
  735.       while ( true ) switch ( ( buffer [ bufptr2 ] ) ) 
  736.       {case 125 : 
  737.         {
  738.           decr ( bibbracelevel ) ; 
  739.           {
  740.         if ( ( exbufptr == bufsize ) ) 
  741.         {
  742.           bibfieldtoolongprint () ; 
  743.           goto lab10 ; 
  744.         } 
  745.         else {
  746.             
  747.           exbuf [ exbufptr ] = 125 ; 
  748.           incr ( exbufptr ) ; 
  749.         } 
  750.           } 
  751.           incr ( bufptr2 ) ; 
  752.           {
  753.         if ( ( ( lexclass [ buffer [ bufptr2 ] ] == 1 ) || ( bufptr2 
  754.         == last ) ) ) 
  755.         if ( ( ! compressbibwhite () ) ) 
  756.         goto lab10 ; 
  757.           } 
  758.           if ( ( bibbracelevel == 0 ) ) 
  759.           goto lab15 ; 
  760.         } 
  761.         break ; 
  762.       case 123 : 
  763.         {
  764.           incr ( bibbracelevel ) ; 
  765.           {
  766.         if ( ( exbufptr == bufsize ) ) 
  767.         {
  768.           bibfieldtoolongprint () ; 
  769.           goto lab10 ; 
  770.         } 
  771.         else {
  772.             
  773.           exbuf [ exbufptr ] = 123 ; 
  774.           incr ( exbufptr ) ; 
  775.         } 
  776.           } 
  777.           incr ( bufptr2 ) ; 
  778.           {
  779.         if ( ( ( lexclass [ buffer [ bufptr2 ] ] == 1 ) || ( bufptr2 
  780.         == last ) ) ) 
  781.         if ( ( ! compressbibwhite () ) ) 
  782.         goto lab10 ; 
  783.           } 
  784.         } 
  785.         break ; 
  786.         default: 
  787.         {
  788.           {
  789.         if ( ( exbufptr == bufsize ) ) 
  790.         {
  791.           bibfieldtoolongprint () ; 
  792.           goto lab10 ; 
  793.         } 
  794.         else {
  795.             
  796.           exbuf [ exbufptr ] = buffer [ bufptr2 ] ; 
  797.           incr ( exbufptr ) ; 
  798.         } 
  799.           } 
  800.           incr ( bufptr2 ) ; 
  801.           {
  802.         if ( ( ( lexclass [ buffer [ bufptr2 ] ] == 1 ) || ( bufptr2 
  803.         == last ) ) ) 
  804.         if ( ( ! compressbibwhite () ) ) 
  805.         goto lab10 ; 
  806.           } 
  807.         } 
  808.         break ; 
  809.       } 
  810.       lab15: ; 
  811.     } 
  812.       } 
  813.       break ; 
  814.     case 125 : 
  815.       {
  816.     bibunbalancedbracesp () ; 
  817.     goto lab10 ; 
  818.       } 
  819.       break ; 
  820.       default: 
  821.       {
  822.     {
  823.       if ( ( exbufptr == bufsize ) ) 
  824.       {
  825.         bibfieldtoolongprint () ; 
  826.         goto lab10 ; 
  827.       } 
  828.       else {
  829.           
  830.         exbuf [ exbufptr ] = buffer [ bufptr2 ] ; 
  831.         incr ( exbufptr ) ; 
  832.       } 
  833.     } 
  834.     incr ( bufptr2 ) ; 
  835.     {
  836.       if ( ( ( lexclass [ buffer [ bufptr2 ] ] == 1 ) || ( bufptr2 == last 
  837.       ) ) ) 
  838.       if ( ( ! compressbibwhite () ) ) 
  839.       goto lab10 ; 
  840.     } 
  841.       } 
  842.       break ; 
  843.     } 
  844.   } 
  845.   else {
  846.       
  847.     while ( ( buffer [ bufptr2 ] != rightstrdelim ) ) if ( ( buffer [ bufptr2 
  848.     ] == 123 ) ) 
  849.     {
  850.       incr ( bibbracelevel ) ; 
  851.       incr ( bufptr2 ) ; 
  852.       {
  853.     if ( ( ! eatbibwhitespace () ) ) 
  854.     {
  855.       eatbibprint () ; 
  856.       goto lab10 ; 
  857.     } 
  858.       } 
  859.       while ( ( bibbracelevel > 0 ) ) {
  860.       
  861.     if ( ( buffer [ bufptr2 ] == 125 ) ) 
  862.     {
  863.       decr ( bibbracelevel ) ; 
  864.       incr ( bufptr2 ) ; 
  865.       {
  866.         if ( ( ! eatbibwhitespace () ) ) 
  867.         {
  868.           eatbibprint () ; 
  869.           goto lab10 ; 
  870.         } 
  871.       } 
  872.     } 
  873.     else if ( ( buffer [ bufptr2 ] == 123 ) ) 
  874.     {
  875.       incr ( bibbracelevel ) ; 
  876.       incr ( bufptr2 ) ; 
  877.       {
  878.         if ( ( ! eatbibwhitespace () ) ) 
  879.         {
  880.           eatbibprint () ; 
  881.           goto lab10 ; 
  882.         } 
  883.       } 
  884.     } 
  885.     else {
  886.         
  887.       incr ( bufptr2 ) ; 
  888.       if ( ( ! scan2 ( 125 , 123 ) ) ) 
  889.       {
  890.         if ( ( ! eatbibwhitespace () ) ) 
  891.         {
  892.           eatbibprint () ; 
  893.           goto lab10 ; 
  894.         } 
  895.       } 
  896.     } 
  897.       } 
  898.     } 
  899.     else if ( ( buffer [ bufptr2 ] == 125 ) ) 
  900.     {
  901.       bibunbalancedbracesp () ; 
  902.       goto lab10 ; 
  903.     } 
  904.     else {
  905.     
  906.       incr ( bufptr2 ) ; 
  907.       if ( ( ! scan3 ( rightstrdelim , 123 , 125 ) ) ) 
  908.       {
  909.     if ( ( ! eatbibwhitespace () ) ) 
  910.     {
  911.       eatbibprint () ; 
  912.       goto lab10 ; 
  913.     } 
  914.       } 
  915.     } 
  916.   } 
  917.   incr ( bufptr2 ) ; 
  918.   Result = true ; 
  919.   lab10: ; 
  920.   return(Result) ; 
  921. boolean scanafieldtokenandea () {
  922.     /* 10 */ register boolean Result; Result = 
  923.   false ; 
  924.   switch ( ( buffer [ bufptr2 ] ) ) 
  925.   {case 123 : 
  926.     {
  927.       rightstrdelim = 125 ; 
  928.       if ( ( ! scanbalancedbraces () ) ) 
  929.       goto lab10 ; 
  930.     } 
  931.     break ; 
  932.   case 34 : 
  933.     {
  934.       rightstrdelim = 34 ; 
  935.       if ( ( ! scanbalancedbraces () ) ) 
  936.       goto lab10 ; 
  937.     } 
  938.     break ; 
  939.   case 48 : 
  940.   case 49 : 
  941.   case 50 : 
  942.   case 51 : 
  943.   case 52 : 
  944.   case 53 : 
  945.   case 54 : 
  946.   case 55 : 
  947.   case 56 : 
  948.   case 57 : 
  949.     {
  950.       if ( ( ! scannonneginteger () ) ) 
  951.       {
  952.     {
  953.       (void) Fputs( logfile ,  "A digit disappeared" ) ; 
  954.       (void) Fputs( stdout ,  "A digit disappeared" ) ; 
  955.     } 
  956.     printconfusion () ; 
  957.     longjmp(jmp9998,1) ; 
  958.       } 
  959.       if ( ( storefield ) ) 
  960.       {
  961.     tmpptr = bufptr1 ; 
  962.     while ( ( tmpptr < bufptr2 ) ) {
  963.         
  964.       {
  965.         if ( ( exbufptr == bufsize ) ) 
  966.         {
  967.           bibfieldtoolongprint () ; 
  968.           goto lab10 ; 
  969.         } 
  970.         else {
  971.         
  972.           exbuf [ exbufptr ] = buffer [ tmpptr ] ; 
  973.           incr ( exbufptr ) ; 
  974.         } 
  975.       } 
  976.       incr ( tmpptr ) ; 
  977.     } 
  978.       } 
  979.     } 
  980.     break ; 
  981.     default: 
  982.     {
  983.       scanidentifier ( 44 , rightouterdelim , 35 ) ; 
  984.       {
  985.     if ( ( ( scanresult == 3 ) || ( scanresult == 1 ) ) ) 
  986.     ; 
  987.     else {
  988.         
  989.       bibidprint () ; 
  990.       {
  991.         {
  992.           (void) Fputs( logfile ,  "a field part" ) ; 
  993.           (void) Fputs( stdout ,  "a field part" ) ; 
  994.         } 
  995.         biberrprint () ; 
  996.         goto lab10 ; 
  997.       } 
  998.     } 
  999.       } 
  1000.       if ( ( storefield ) ) 
  1001.       {
  1002.     lowercase ( buffer , bufptr1 , ( bufptr2 - bufptr1 ) ) ; 
  1003.     macronameloc = strlookup ( buffer , bufptr1 , ( bufptr2 - bufptr1 ) , 
  1004.     13 , false ) ; 
  1005.     storetoken = true ; 
  1006.     if ( ( atbibcommand ) ) 
  1007.     if ( ( commandnum == 2 ) ) 
  1008.     if ( ( macronameloc == curmacroloc ) ) 
  1009.     {
  1010.       storetoken = false ; 
  1011.       {
  1012.         macrowarnprint () ; 
  1013.         {
  1014.           {
  1015.         (void) fprintf( logfile , "%s\n",  "used in its own definition" ) ; 
  1016.         (void) fprintf( stdout , "%s\n",  "used in its own definition" ) ; 
  1017.           } 
  1018.           bibwarnprint () ; 
  1019.         } 
  1020.       } 
  1021.     } 
  1022.     if ( ( ! hashfound ) ) 
  1023.     {
  1024.       storetoken = false ; 
  1025.       {
  1026.         macrowarnprint () ; 
  1027.         {
  1028.           {
  1029.         (void) fprintf( logfile , "%s\n",  "undefined" ) ; 
  1030.         (void) fprintf( stdout , "%s\n",  "undefined" ) ; 
  1031.           } 
  1032.           bibwarnprint () ; 
  1033.         } 
  1034.       } 
  1035.     } 
  1036.     if ( ( storetoken ) ) 
  1037.     {
  1038.       tmpptr = strstart [ ilkinfo [ macronameloc ] ] ; 
  1039.       tmpendptr = strstart [ ilkinfo [ macronameloc ] + 1 ] ; 
  1040.       if ( ( exbufptr == 0 ) ) 
  1041.       if ( ( ( lexclass [ strpool [ tmpptr ] ] == 1 ) && ( tmpptr < 
  1042.       tmpendptr ) ) ) 
  1043.       {
  1044.         {
  1045.           if ( ( exbufptr == bufsize ) ) 
  1046.           {
  1047.         bibfieldtoolongprint () ; 
  1048.         goto lab10 ; 
  1049.           } 
  1050.           else {
  1051.           
  1052.         exbuf [ exbufptr ] = 32 ; 
  1053.         incr ( exbufptr ) ; 
  1054.           } 
  1055.         } 
  1056.         incr ( tmpptr ) ; 
  1057.         while ( ( ( lexclass [ strpool [ tmpptr ] ] == 1 ) && ( tmpptr < 
  1058.         tmpendptr ) ) ) incr ( tmpptr ) ; 
  1059.       } 
  1060.       while ( ( tmpptr < tmpendptr ) ) {
  1061.           
  1062.         if ( ( lexclass [ strpool [ tmpptr ] ] != 1 ) ) 
  1063.         {
  1064.           if ( ( exbufptr == bufsize ) ) 
  1065.           {
  1066.         bibfieldtoolongprint () ; 
  1067.         goto lab10 ; 
  1068.           } 
  1069.           else {
  1070.           
  1071.         exbuf [ exbufptr ] = strpool [ tmpptr ] ; 
  1072.         incr ( exbufptr ) ; 
  1073.           } 
  1074.         } 
  1075.         else if ( ( exbuf [ exbufptr - 1 ] != 32 ) ) 
  1076.         {
  1077.           if ( ( exbufptr == bufsize ) ) 
  1078.           {
  1079.         bibfieldtoolongprint () ; 
  1080.         goto lab10 ; 
  1081.           } 
  1082.           else {
  1083.           
  1084.         exbuf [ exbufptr ] = 32 ; 
  1085.         incr ( exbufptr ) ; 
  1086.           } 
  1087.         } 
  1088.         incr ( tmpptr ) ; 
  1089.       } 
  1090.     } 
  1091.       } 
  1092.     } 
  1093.     break ; 
  1094.   } 
  1095.   {
  1096.     if ( ( ! eatbibwhitespace () ) ) 
  1097.     {
  1098.       eatbibprint () ; 
  1099.       goto lab10 ; 
  1100.     } 
  1101.   } 
  1102.   Result = true ; 
  1103.   lab10: ; 
  1104.   return(Result) ; 
  1105.